<?php
            $this->headTitle($this->title);
             $this->headScript()->appendFile(Zend_Registry::get('static_path').'js/users.js');
            $this->headLink()->appendStylesheet(Zend_Registry::get('static_path').'css/user.css');
            $this->layout()->setLayout('userlayout');
?>
<div class="nav"><a href="<?php echo $this->url(array( 'controller' => 'admin', 'action'     => 'index'),'default', true) ?>" class="navlink">Control Panel</a><img src="../images/arrow.gif" class="arrow"/> Add User</div>
<div id="userForm">
    <ul class="tabs">
        <li class="active"><a href="<?php echo $this->url(array( 'controller' => 'user', 'action'     => 'add'),'default', true) ?>">Add User</a></li>
        <li ><a href="<?php echo $this->url(array( 'controller' => 'user', 'action'     => 'edit'),'default', true) ?>">Edit User</a></li>
    </ul>
    <div id="form-container">
        <form  class="form" name="userForm" method="post" action="<?php echo $this->url(array( 'controller' => 'user', 'action'     => 'add'),'default', true) ?>">
             <input type="hidden" name="action" value="A"/>
            <table class="dataTable">
                <tbody>
                    <tr><td colspan="2" align="center"> <?php echo $this->message  ?></td></tr>
                     <tr>
                        <td width="20%"><label>Email Address:<img src="../images/redStar.gif"/></label></td>
                        <td> <input type="text" name="emailAddress" size="30"  id="emailAddress" maxlength="30">&nbsp;&nbsp;&nbsp;<span id="emailError" class="error"></span></td>
                    </tr>
                    <tr>
                        <td width="20%"><label>First Name:<img src="../images/redStar.gif"/></label></td>
                        <td> <input type="text" name="firstName"  id="firstName"  size="30" maxlength="30">&nbsp;&nbsp;&nbsp;<span id="firstNameError" class="error"></span></td>
                    </tr>
                    <tr>
                        <td width="20%"><label>Last Name:<img src="../images/redStar.gif"/></label></td>
                        <td> <input type="text" name="lastName"  id="lastName"  size="30" maxlength="30">&nbsp;&nbsp;&nbsp;<span id="lastNameError" class="error"></span></td>
                    </tr>
                    <tr>
                        <td width="20%"><label>Address Line 1:</label></td>
                        <td> <input type="text" name="address1"  size="50" maxlength="50"></td>
                    </tr>
                     <tr>
                        <td width="20%"><label>Address Line 2:</label></td>
                        <td> <input type="text" name="address2" size="50" maxlength="50"></td>
                    </tr>
                     <tr>
                        <td width="20%"><label>City:</label></td>
                        <td> <input type="text" name="city" maxlength="20" value="Suwanee"></td>
                    </tr>
                     <tr>
                        <td width="20%"><label>State:</label></td>
                        <td>  <select id="state" name="state" >
                            </select></td>
                    </tr>
                     <tr>
                        <td width="20%"><label>Country:</label></td>
                        <td> <select id="country" name="country" >
                            </select>
                        </td>
                    </tr>
                     <tr>
                        <td width="20%"><label>Zip:</label></td>
                        <td> <input type="text" name="zip" maxlength="5" size="6" value="30024"></td>
                    </tr>
                     <tr>
                        <td width="20%"><label>Phone Number 1:</label></td>
                        <td> <input type="text" name="phone1" maxlength="20" size="11"></td>
                    </tr>
                     <tr>
                        <td width="20%"><label>Phone Number 2:</label></td>
                        <td> <input type="text" name="phone2" maxlength="20" size="11"></td>
                    </tr>
                     <tr>
                        <td width="20%"><label>Cell:</label></td>
                        <td> <input type="text" name="cell" maxlength="20" size="11"></td>
                    </tr>
                    <tr>
                        <td width="20%"><label>Email 2:</label></td>
                        <td> <input type="text" name="email2"  size="30" maxlength="30"></td>
                    </tr>
                    <tr>
                        <td width="20%"><label>Privileges:<img src="../images/redStar.gif"/></label></td>
                        <td> <input type="checkbox" name="option1" id="option1" value="Y"> Resident&nbsp;&nbsp;<input type="checkbox" name="option2"   id="option2" value="Y"> Admin
                        &nbsp;&nbsp;&nbsp;<span id="roleError" class="error"></span></td>
                    </tr>
                     <tr>
                        <td colspan="2" align="center"><input type="button" id="addUser" value="Submit"/></td>
                    </tr>
                </tbody>
            </table>
         </form>
    </div>
</div>
<br>
<script>
 $(document).ready(function(){
     $.getJSON("../process/country", function(call){
         var selected="";
         $.each(call, function(key, value){
             if(key=="USA"){selected = "selected"}else{selected =""};
          $("#country").append('<option value="'+key+'" '+selected+'>'+value+'</option>');
        });
     });

   $.getJSON("../process/state", function(call){
         var selected="";
         $.each(call, function(key, value){
             if(key=="GA"){selected = "selected"}else{selected =""};
          $("#state").append('<option value="'+key+'" '+selected+'>'+value+'</option>');
        });
     });
 });

</script>